package com.xiaohe66.web.domain.sys.sec.value;

import com.xiaohe66.common.util.Assert;
import com.xiaohe66.common.value.ErrorCodeEnum;
import com.xiaohe66.web.integration.domain.StringValue;
import lombok.EqualsAndHashCode;
import lombok.NonNull;

/**
 * @author He
 * @since 2023.12.27 17:51
 */
@EqualsAndHashCode(callSuper = true)
public class SysConfigKey extends StringValue {

    public static final SysConfigKey SYS_PUBLIC_KEY_KEY = new SysConfigKey("SYS_PUBLIC_KEY");
    public static final SysConfigKey SYS_PRIVATE_KEY_KEY = new SysConfigKey("SYS_PRIVATE_KEY");
    public static final SysConfigKey SYS_JWT_SECRET_KEY = new SysConfigKey("SYS_JWT_SECRET_KEY");

    public SysConfigKey(@NonNull String value) {
        super(value);

        Assert.requireTrue(value.length() <= 32, ErrorCodeEnum.PARAM_ILLEGAL, "key长度不能超过32");
    }

    @Override
    public String toString() {
        return "SysConfigKey(" + getValue() + ")";
    }
}
